package com.ag.dgm.service.impl;

import java.util.List;


import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ag.bean.TbPlanStatus;
import com.ag.common.AgException;
import com.ag.common.IDServiceImpl;
import com.ag.common.IDUtil;
import com.ag.dgm.dao.TbPlanStatusDAO;
import com.ag.dgm.service.PlanStatusService;

@Service("planStatusService")
public class PlanStatusServiceImpl implements PlanStatusService {
@Resource(name="DGMTbPlanStatusDAO")
private TbPlanStatusDAO tbPlanStatusDAO;
@Resource(name="iDServiceImpl")
private IDServiceImpl idService;




	@Override
	public void add(TbPlanStatus tbPlanStatus) {	
		String IDs = null;
		try {
			IDs = idService.findTablePK(IDUtil.TB_PLAN_STATUS);
		} catch (AgException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		tbPlanStatus.setPstId(IDs);
		tbPlanStatusDAO.save(tbPlanStatus);
	}
	
	public void delete(TbPlanStatus ptr){
		TbPlanStatus tbPlanStatus = tbPlanStatusDAO.findById(ptr.getPstId());
		tbPlanStatusDAO.delete(tbPlanStatus);
	}

	@Override
	public void modify(TbPlanStatus tbPlanStatus) {
		tbPlanStatusDAO.attachDirty(tbPlanStatus);		
	}



	@Override
	public List<TbPlanStatus> findAll() {		
		return tbPlanStatusDAO.findAll();
	}

}
